import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace BaseinfoProductRecordApi {
  /** 产品记录信息 */
  export interface BaseinfoProductRecord {
    id: number; // 序号
    productName: string; // 产品名称
    productNo: string; // 产品编号
    tags: string; // 关键词
    productStatus: string; // 产品状态
    userName: string; // 用户名称
  }
}

/** 查询产品记录分页 */
export function getBaseinfoProductRecordPage(params: PageParam) {
  return requestClient.get<PageResult<BaseinfoProductRecordApi.BaseinfoProductRecord>>('/csyt/baseinfo-product-record/page', { params });
}

/** 查询产品记录详情 */
export function getBaseinfoProductRecord(id: number) {
  return requestClient.get<BaseinfoProductRecordApi.BaseinfoProductRecord>(`/csyt/baseinfo-product-record/get?id=${id}`);
}

/** 新增产品记录 */
export function createBaseinfoProductRecord(data: BaseinfoProductRecordApi.BaseinfoProductRecord) {
  return requestClient.post('/csyt/baseinfo-product-record/create', data);
}

/** 修改产品记录 */
export function updateBaseinfoProductRecord(data: BaseinfoProductRecordApi.BaseinfoProductRecord) {
  return requestClient.put('/csyt/baseinfo-product-record/update', data);
}

/** 删除产品记录 */
export function deleteBaseinfoProductRecord(id: number) {
  return requestClient.delete(`/csyt/baseinfo-product-record/delete?id=${id}`);
}

/** 批量删除产品记录 */
export function deleteBaseinfoProductRecordList(ids: number[]) {
  return requestClient.delete(`/csyt/baseinfo-product-record/delete-list?ids=${ids.join(',')}`)
}

/** 导出产品记录 */
export function exportBaseinfoProductRecord(params: any) {
  return requestClient.download('/csyt/baseinfo-product-record/export-excel', params);
}

